home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / src / adoc_src.lha / adoc-0.17 / args.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-20  |  7.8 KB  |  147 lines

  1. /*                                                               -*- C -*-
  2.  *  ARGS.C
  3.  *
  4.  *  (c)Copyright 1995 by Tobias Ferber,  All Rights Reserved
  5.  *
  6.  *  This file is part of ADOC.
  7.  *
  8.  *  ADOC is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published
  10.  *  by the Free Software Foundation; either version 1 of the License,
  11.  *  or (at your option) any later version.
  12.  *
  13.  *  ADOC is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with this program; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. /* $VER: $Id: args.c,v 1.8 1995/03/20 18:44:04 tf Exp $ */
  24.  
  25. #include <string.h>
  26. #include <stdio.h>
  27.  
  28. static char *howtouse[]= {
  29.  
  30.   "-",              "--stdin",                  "",            "read source code from stdin",
  31.   "-0",             "--no-output",              "",            "do not write any output (same as `-n')",
  32.   "-1",             "--autodoc",                "",            "create autodoc output (default)",
  33.   "-2",             "--texinfo",                "",            "create texinfo output",
  34.   "-2",             "--texi",                   "",            "",
  35.   "-b",             "--texi-funtable",          "",            "create a @table for each function",
  36.   "-B",             "--body-environment",       "<string>",    "put body text into a @<string> environment",
  37.  
  38. /*
  39.   "-Bexample",      "--example",                "",            "put body text into an @example environment",
  40.   "-Bsmallexample", "--small-example",          "",            "put body text into a @smallexample environment",
  41.   "-Bsmallexample", "--smallexample",           "",            "",
  42.   "-Bdisplay",      "--display",                "",            "put body text into a @display environment",
  43. */
  44.  
  45.   "-c",             "--flip-slashes",           "",            "convert \\* to /* and *\\ to */",
  46.   "-c",             "--convert",                "",            "",
  47.  
  48. #ifdef DEBUG
  49.   "-d",             "--debug",                  "<number>",    "set debug level to <number>",
  50. #endif
  51.  
  52.   "-D<macro>",      "",                         "<value>",     "define a texinfo header macro",
  53.   "-DPROJECT",      "--project",                "<string>",    "define a value for the PROJECT macro",
  54.   "-DEDITION",      "--edition",                "<string>",    "define a value for the EDITION macro",
  55.   "-DCOPYRIGHT",    "--copyright",              "<string>",    "define a value for the COPYRIGHT macro",
  56.   "-DAUTHOR",       "--author",                 "<string>",    "define a value for the AUTHOR macro",
  57.   "-E",             "--error-file",             "<filename>",  "redirect error messages (default is stderr)",
  58.   "-f",             "--no-form-feeds",          "",            "no form feeds (^L) or @page between entries",
  59.   "-f",             "--no-ff",                  "",            "",
  60.   "-ff",            "--form-feeds",             "",            "begin a new page for each function",
  61.   "-g",             "--no-grouping",            "",            "no creation of @group ... @end group",
  62.   "-g",             "--no-groups",              "",            "",
  63.   "-gs",            "--group-sections",         "",            "put keyword sections into a @group",
  64.   "-H",             "--texi-header-file",       "<filename>",  "read texinfo header from file <filename>",
  65.   "-h",             "--help",                   "",            "print this short usage information and exit",
  66.   "-i",             "--internal",               "",            "process only internal autodocs (same as `-yi')",
  67.   "-I",             "--table-of-contents",      "",            "output table of contents before entries",
  68.   "-I",             "--toc",                    "",            "",
  69.   "-l",             "--line-length",            "<number>",    "set autodoc page width to <number> columns",
  70.   "-l",             "--page-width",             "",            "",
  71.   "-l",             "--width",                  "",            "",
  72.   "-l",             "--columns",                "",            "",
  73.   "-l",             "--cols",                   "",            "",
  74.   "-M<macro>",      "",                         "<value>",     "define a body text macro",
  75.   "-n",             "--dry-run",                "",            "do not write any output (same as `-0')",
  76.   "-n",             "--dryrun",                 "",            "",
  77.   "-o",             "--output-file",            "<filename>",  "set output filename (default is stdout)",
  78.   "-p",             "--preserve-order",         "",            "don't sort autodoc entries",
  79.   "-p",             "--no-sort",                "",            "",
  80.   "-q",             "--quiet",                  "",            "don't print information while processing",
  81.   "-q",             "--silent",                 "",            "",
  82.   "-q",             "--brief",                  "",            "",
  83.   "-t",             "--tabs-to-spaces",         "",            "turn tabs to spaces (same as `-T8')",
  84.   "-T",             "--tab-size",               "<number>",    "set tab step to <number> columns",
  85.   "-T",             "--tabsize",                "",            "",
  86.   "-U",             "",                         "<macro>",     "undefine a macro defined via `-D' or `-M'",
  87.   "-v",             "--version",                "",            "print author and version information",
  88.   "-W",             "--no-warnings",            "",            "don't print any warnings",
  89.   "-Wkeywords",     "--check-keywords",         "",            "check section keywords while reading",
  90.   "-Wabsence",      "--check-presence",         "",            "look for missing section keywords",
  91.   "-Wall",          "--pedantic",               "",            "complain about almost everything",
  92.   "-x",             "--no-references",          "",            "print the SEE ALSO section as it is",
  93.   "-xoff",          "--no-xrefs",               "",            "",
  94.   "-xon",           "--parse-references",       "",            "try to create @xref{}s from SEE ALSO",
  95.   "-xitemize",      "--itemize-references",     "",            "put @xref{}s into an @itemize list",
  96.   "-y",             "--yank-type",              "<string>",    "process only comments of type <string>",
  97.   "-y",             "--input-type",             "",            "",
  98.   "-y",             "--comment-type",           "",            "",
  99.   "-z",             "--no-texi-header",         "",            "ommit writing texinfo header and title page",
  100.  
  101. #if 0
  102.  
  103.   /*
  104.    *  The following options are ignored for compatibility
  105.    *  with Bill Koester's original version `autodoc' which
  106.    *  is part of C=ommodore's Native Developer Kit (NDK).
  107.    */
  108.  
  109.   "-C",             "--slash-asterisk",         "",            "process autodocs starting with /*",
  110.   "-s",             "--semicolon",              "",            "process autodocs starting with a semicolon",
  111.   "-a",             "--asterisk",               "",            "process autodocs starting with an asterisk",
  112.   "-F",             "--tempfile",               "<filename>",  "ignored for compatibility",
  113.   "-r",             "--troff",                  "",            "ignored for compatibility",
  114.   "-w",             "--no-word-wrap",           "",            "ignored for compatibility",
  115.  
  116. #endif /*0*/
  117.  
  118.   (char *)0, (char *)0, (char *)0, (char *)0
  119. };
  120.  
  121. char *
  122. convert_args(s)
  123. char *s;
  124. {
  125.   char **t= howtouse;
  126.  
  127.   while(*t) {
  128.     if(!strcmp(s,t[1]))
  129.       break;
  130.     t= &t[4];
  131.   }
  132.  
  133.   return (*t) ? *t : s;
  134. }
  135.  
  136. void
  137. display_args(void)
  138. {
  139.   char **t= howtouse;
  140.  
  141.   while(*t) {
  142.     if(t[3] && *t[3])
  143.       printf("%-12s %s %-20s %-13s %s\n",t[0],t[1][0] ? "or":"  ",t[1],t[2],t[3]);
  144.     t= &t[4];
  145.   }
  146. }
  147.